﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ReadyApps.Wiki
{
    class WikiDefaultLayoutTemplate : ITemplate
    {
        public void InstantiateIn(Control container)
        {
            Panel outerContainer = new Panel();
            Panel controlsContainer = new Panel();
            controlsContainer.ID = WikiController.CONTROLS_CONTROL_ID;
            controlsContainer.Style.Add("float", "right");
            outerContainer.Controls.Add(controlsContainer);
            outerContainer.Controls.Add(new PlaceHolder() { ID = WikiController.CONTENT_CONTROL_ID });
            container.Controls.Add(outerContainer);
        }
    }

    class WikiDefaultPageNotFoundTemplate : ITemplate
    {
        public void InstantiateIn(Control container)
        {
            container.Controls.Add(new Literal()
            {
                Text = @"
<h1 style=""color: Red;"">Page Not Found</h1>
<p>The requested page was not found. Please check the URL for correctness or report
a bad link to the website administrator.</p>"
            });
        }
    }

    class WikiDefaultNotAuthorizedTemplate : ITemplate
    {
        public void InstantiateIn(Control container)
        {
            container.Controls.Add(new Literal()
            {
                Text = @"
<h1 style=""color: Red;"">Not Authorized</h1>
<p>You do not have permission to view this page. If you believe this to be in error, please
contact the website administrator.</p>"
            });
        }
    }

    class WikiDefaultButtonTemplate : ITemplate
    {
        public void InstantiateIn(Control container)
        {
            container.Controls.Add(new Button()
            {
                ID = WikiController.BUTTON_CONTROL_ID
            });
        }
    }
}
